﻿//加入收藏and设为首页--Start
function  addFav(url,title) {   //加入收藏夹   
	 try{
		    window.external.addFavorite(url,title);   
	    }catch (e){
			 try{
			        window.sidebar.addPanel(title,url,"");     
			     }catch(e){ 
				    alert("此浏览器不支持自动添加收藏夹，请查看浏览器的添加书签功能，手动收藏!"); 
			     } 
	    }

}
function SetHome(obj){   
    try{   
        obj.style.behavior='url(#default#homepage)';   
        obj.setHomePage('http://www.sdtaw.com/');   
    }catch(e){   
        if(window.netscape){   
            try{   
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");   
            }catch(e){   
                alert("抱歉，此操作被浏览器拒绝！\n\n请在浏览器地址栏输入“about:config”并回车然后将[signed.applets.codebase_principal_support]设置为'true'");   
            }  
        }else{   
            alert("抱歉，您所使用的浏览器无法完成此操作。\n\n您需要手动将'http://cancer.sdtaw.com/'设置为首页。"); 
        }  
    }  
}
//加入收藏and设为首页--End

//复制链接推荐给好友
function CopyURL(){
var myHerf=this.location.href;
var title=document.title;
	if(window.clipboardData){
		var tempCurLink=title + "\n" + myHerf;
		var ok=copyToClipboard(tempCurLink);
        alert("按Ctrl + V ,粘贴到MSN上发给你的好友们吧 ！");
	}else{
		alert("对不起，目前此功能只支持IE，请直接复制地址栏的地址！");
		}
}

function   copyToClipboard(txt)   {  
          
            if(window.clipboardData)   {  
                            window.clipboardData.clearData();  
                            window.clipboardData.setData("Text",   txt);  
            }   else   if(navigator.userAgent.indexOf("Opera")   !=   -1)   {  
                      window.location   =   txt;  
            }   else   if   (window.netscape)   {  
                      try   {  
                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
                      }   catch   (e)   {  
                                alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将 'signed.applets.codebase_principal_support'设置为'true'");  
                      }  
                      var   clip   =   Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);  
                      if   (!clip)  
                                return;  
                      var   trans   =   Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);  
                      if   (!trans)  
                                return;  
                      trans.addDataFlavor('text/unicode');  
                      var   str   =   new   Object();  
                      var   len   =   new   Object();  
                      var   str   =   Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);  
                      var   copytext   =   txt;  
                      str.data   =   copytext;  
                      trans.setTransferData("text/unicode",str,copytext.length*2);  
                      var   clipid   =   Components.interfaces.nsIClipboard;  
                      if   (!clip)  
                                return   false;  
                      clip.setData(trans,null,clipid.kGlobalClipboard);  
            }  
  }  
//复制链接推荐给好友